package projeto1;

import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.mysql.jdbc.Statement;

public class BDLogin{
	
	public boolean valida;
	public void BDLogar (String login,String senha) {
		Connection con = null;
		Statement consulta = null;
		ResultSet tabela = null;
				
		try {
			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://localhost/acesso","root" ,"002012");
			consulta = (Statement) con.createStatement();
			tabela = consulta.executeQuery("select login, senha from usuario where login='"+login+"'and senha='"+senha+"'");
			
			if(tabela.next()){
				valida = true;
			}
			else{
				valida = false;
			}
			
		}
		catch(ClassNotFoundException |SQLException e){
		}
		
	}
	
	
	
	
}